package com.le.tester.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述：二进制手表
 */
public class ReadBinaryWatch {
    public List<String> readBinaryWatch(int turnOn) {

        List<String> result = new ArrayList<>();
        for (int i = 0; i < 12; i++) {
            for (int j = 0; j < 60; j++) {
                if (Integer.bitCount(i) + Integer.bitCount(j) == turnOn) {
                    result.add(i + ":" + (j < 10 ? "0" : "") + j);
                }
            }
        }
        return result;
    }
}
